unit UObjFunction;

interface

uses ShellAPI, Windows, Classes, Db, DbGrids, DateUtils, IniFiles, Messages, StdCtrls, Winspool, SysUtils;


Const
  constDB_FILE_BANCODADOS = 'CRWebImporta.udl'        ;
  constDB_FILE_CONFIG     = 'CRWEBImporta_Erro_'      ;
  constDB_INI_FILE_CONFIG = 'CRWEBImporta'            ;
  constCRWeb              = 'CRWeb_'                  ;
  ConstCRWebSuporte       = 'CRWebSuporte'            ;
  ConstCRWebSuporte_      = 'CRWebSuporte_UPSTPARC'   ;
  ConstCRWebSuporte_UP    = 'CRWebSuporte_UPBOLETO'   ;

  //EGS-22.01.2007 - Constantes do LOG de Comandos SQLServer
  _constLOGSuporte_Processo    = 25;
  _constLOGSuporte_Tabela      = 25;
  _constLOGSuporte_Comando     =  3;
  _constLOGSuporte_Condicao    = 40;
  _constLOGSuporte_Motivo      = 40;
  _constLOGSuporte_Descricao   = 40;
  _constLOGSuporte_Solicitante = 20;

  ConstCR_DTS  = 'CR-DTS_';
  ConstCripto  = 'IA1BwCFG2JKEM-3OPQRHSTU6VyWDYZ8ablcd4efXghrij5Lkno7+qst9uvxmz0p/N ';
  ConstDeCrip  = '+S-1VA9B2DE3FeGH4IJaK5LM/N6OPpQ7RTs8CUWXYZbcfxghi0jklmdoqrtuvwynz ';


type
  TObjFunction = class
    private

    protected

    public
      function GetVariavelDOS(Variavel: String): String;

  end;

implementation

{ TObjFunction }

function TObjFunction.GetVariavelDOS(Variavel: String): String;
  var
    Env: PChar;
    PosEq: Integer;
    xVaria, Varia: String;
begin
  xVaria := '';
  Varia := '';
  Env   := GetEnvironmentStrings;
  while Env^ <> #0 do
  begin
    xVaria := UpperCase(StrPas(Env));
    PosEq := Pos('=',xVaria);
    if Copy(xVaria,1,PosEq-1) = Variavel then
    begin
      Varia := Copy(xVaria,PosEq+1,Length(xVaria));
    end;
    Inc(Env, (StrLen(Env) + 1));
  end;
  Result := Varia;
end;

end.
 